//
//  HGLLabel.m
//  GoldPig
//
//  Created by 虎爷 on 2020/1/6.
//  Copyright © 2020 虎爷. All rights reserved.
//

#import "HGLLabel.h"

@implementation HGLLabel
#define UIHexColor(name) [UIColor colorFromHexString:name]

- (void)drawTextInRect:(CGRect)rect {
    CGSize shadowOffset = self.shadowOffset;
    UIColor *textColor = self.textColor;
    
    CGContextRef c = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(c, 3.0);//字体边缘的宽度
    CGContextSetLineJoin(c, kCGLineJoinRound);
    
    CGContextSetTextDrawingMode(c, kCGTextStroke);
    self.textColor = UIHexColor(@"#F33B40");//字体边缘加的颜色
    [super drawTextInRect:rect];
    
    CGContextSetTextDrawingMode(c, kCGTextFill);
    self.textColor = textColor;
    self.shadowOffset = CGSizeMake(0, 0);
    [super drawTextInRect:rect];
    
    self.shadowOffset = shadowOffset;
}





@end
